#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time   : 2023-11-25 13:57
# @Author : hard work
# @File    : renix_basic_empty.py
# @Description :
import os
import sys

from common.renix_basic_config.renix_config import renix_config


class Renix_basic_config:
    """renix empty"""
    def __init__(self):
        self.__chassis_address = ''

        self.__slot = ''

        self.__port1 = ''

        self.__port2 = ''

        self.__port3 = ''

        self.__port4 = ''

        self.__port5 = ''

        self.__renix_install_addr = ''




    @property
    def chassis_address(self):
        """Renix chassis ip address  """
        return self.__chassis_address

    @property
    def slot(self):
        """Renix slot  """
        return self.__slot

    @property
    def port1(self):
        """Renix port1  """
        return self.__port1

    @property
    def port2(self):
        """Renix port2  """
        return self.__port2

    @property
    def port3(self):
        """Renix port3  """
        return self.__port3

    @property
    def port4(self):
        """Renix port4  """
        return self.__port4

    @property
    def port5(self):
        """Renix port5  """
        return self.__port5

    @chassis_address.setter
    def chassis_address(self, value):
        """renix_install_path"""
        self.__chassis_address = value

    @slot.setter
    def slot(self, value):
        self.__slot = value

    @port1.setter
    def port1(self, value):
        self.__port1 = value

    @port2.setter
    def port2(self, value):
        self.__port2 = value

    @port3.setter
    def port3(self, value):
        self.__port3 = value

    @port4.setter
    def port4(self, value):
        self.__port4 = value

    @port5.setter
    def port5(self, value):
        self.__port5 = value

    @property
    def renix_install_addr(self):
        return self.__renix_install_addr

    @renix_install_addr.setter
    def renix_install_addr(self, value):
        self.__renix_install_addr = value

    def set_renix_SysVariable(self):
        """设置信而泰系统环境变量
        RENIX_SERVER_PATH=$your_renix_install_path\server\.
        your_renix_install_path缺省是C:\Program Files\Xinertel\Renix 3.1.0。
        """
        print('hello', renix_config()['renix_install_addr'])
        renixPythonlibDir = self.__renix_install_addr + '/server/'
        os.environ['RENIX_SERVER_PATH'] = self.__renix_install_addr
        sys.path.append(renixPythonlibDir)
        # try:
        #     if os.path.exists(self.__renix_install_addr):
        #         renixPythonlibDir = self.__renix_install_addr + '/server/'
        #         os.environ['RENIX_SERVER_PATH'] = self.__renix_install_addr
        #         sys.path.append(renixPythonlibDir)
        #     else:
        #         raise "renix install path is not found"
        # except FileNotFoundError as e:
        #     print("renix install path is not found")
        # except OSError:
        #     print("OSError error")
if __name__ == '__main__':
    cfg = Renix_basic_config()

    cfg.chassis_address = renix_config()['chassis_address']
    cfg.renix_install_addr = renix_config()['renix_install_addr']
    print(cfg.renix_install_addr)
    cfg.set_renix_SysVariable()
